<html>
<head><meta charset="utf-8"><title>Clarifying .cargo/config.toml docs · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Clarifying.20.2Ecargo.2Fconfig.2Etoml.20docs.html">Clarifying .cargo/config.toml docs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228896905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Clarifying%20.cargo/config.toml%20docs/near/228896905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Clarifying.20.2Ecargo.2Fconfig.2Etoml.20docs.html#228896905">(Mar 05 2021 at 04:36)</a>:</h4>
<p>In <a href="#narrow/stream/122651-general/topic/.2Ecargo.2Fconfig.20clarification">https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.2Ecargo.2Fconfig.20clarification</a> I had some confusion about when, if ever, fields from the <code>.cargo/config{,.toml}</code> of a dependency is used.</p>
<p>AFAICT, it is never used (or rather: the your crate's dependency graph does not influence which configuration files are used). This is what I expected, and is consistent with what's described here: <a href="https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure">https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure</a>, but I think it could be more clear about the fact that it's "local configuration" (for some definition of local).</p>
<p>Specifically, you can't use it to, for example, set some rustflags that your crate requires, and have this actually work for people depending on your crate.</p>
<p>So, I'd like to improve the docs here to make it clear what the configuration can't be/isn't intended to be used for. That said, not only I am pretty sure whatever I would come up with as a first cut of a doc update wouldn't cut it, but I'm not even sure that my understanding is correct. </p>
<p>Specifically, are these statements all true?</p>
<ol>
<li>configuration from <a href="http://crates.io">crates.io</a> (or other registry) dependencies is never used.</li>
<li>configuration from git (or other vcs) dependencies is never used.</li>
<li>configuration from a path dep will only be used if the path dep is a direct parent, but this configuration would be used even if that path dep did not exist.</li>
<li>more generally: the list of configuration files that are combined to produce the result configuration doesn't consider the dependency graph of whatever is being compiled.</li>
</ol>



<a name="228896922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Clarifying%20.cargo/config.toml%20docs/near/228896922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Clarifying.20.2Ecargo.2Fconfig.2Etoml.20docs.html#228896922">(Mar 05 2021 at 04:36)</a>:</h4>
<p>Also, any suggestions on how to teach this/explain this better?</p>
<p>Somehow I ran into two separate instances of people being confused by this (in one day!), and when I asked in general, for the most part I got responses like "I think thats how it works", rather than anybody being very confident.</p>
<p>I also read the docs several times, and only was <em>fully</em> convinced after doing a bunch of experimenting, and I'm still only like, 90% certain.</p>



<a name="228963973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Clarifying%20.cargo/config.toml%20docs/near/228963973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Clarifying.20.2Ecargo.2Fconfig.2Etoml.20docs.html#228963973">(Mar 05 2021 at 14:40)</a>:</h4>
<p>I just read the conversation in <a class="stream" data-stream-id="122651" href="/#narrow/stream/122651-general">#general</a> , and that seems correct to me. But I would love input from Eric or Alex, who know Cargos corner cases better than I. A PR improving documentation of this would be great, and be a good place to ensure that this does not get lost in the shuffle.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>